<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<meta name="viewport" content="width=device-width, initial-scale=1.0",user-scalable=no>
<!--<link href="/css/bootstrap.min.css" rel="stylesheet">-->
<link href="/fonts/iconfont/iconfont.css" rel="stylesheet">
<head th:include="cultivateWeb/header :: culHeaderCss"></head>

<body>
<!-- 顶部导航 -->
<header th:include="cultivateWeb/header :: header"></header>
<link type="text/css" href="/css/cultivateWeb/style/course.css" rel="stylesheet">
<style>
    .dis_row{
        display: flex;flex-direction: row;
    }
    .dis_column{
        display: flex;flex-direction: column;
    }
    .a_center{
        align-items: center;
    }
    .j_center{
        justify-content: center;
    }
    .discuss_top{
        background: #ffffff;margin-top: 0px;width: 100%;font-size: 16px;color: #999;
        border-bottom: 1px solid #dfdfdf;
        /* height: 150px;*/
        height: 80px;
    }
    .discuss_top_title{
        margin-top: 0px;width: 100%;color: #999;
        height: 80px;
    }
    .discuss_top_content{
        margin-top: 0px;width: 100%;color: #666;
        height: auto;
    }
    .discuss_list{
        background: #ffffff;margin-top: 0px;width: 100%;font-size: 16px;color: #999;
    }
    .discuss_buttons{
        margin-top: 0px;width: 100%;font-size: 16px;
        height: 200px;background-color: #f5f5f5;
    }
    .discuss_buttons_textarea{
        width: 85%;
        border: 1px solid #ccc;
        border-radius: 4px;
        color: #555;
        background: #ffffff;
        padding: 4px 4px;
    }
    .discuss_buttons_send{
        width: 100px;
        height: 35px;
        border-radius: 10px;
        background-color: #22ac38;
        color: #ffffff;
        text-align: center;

    }
</style>
<div style="background-color: #f7f7f7; ">
    <div class="layui-container">
        <p style="line-height: 40px">当前位置：<a href="/cultivate/homepage">首页</a> > <a href="/cultivate/study/studyOnline">在线学习</a> > 学习详情</p>
    </div>
    <div class="container">
        <div class="row">
    <section>
        <div class="img_box">
            <p><img th:src="${cou.thumbnail}" class="img_1" id="courseImg"></p>
            <div class="div_1">
                <input type="hidden" id="courseId" th:value="${cou.id}"/>
                <input type="hidden" id="isTestScores" th:value="${isTestScores}"/>
                <input type="hidden" id="classId" th:value="${classId}"/>
                <input type="hidden" id="taskId" th:value="${taskId}"/>
                <span class="span_1" th:text="${cou.name}"></span>
                <!--            <span class="span_2">共<span style="color: red;">24</span>学时，<span style="color: red;">944</span>分钟</span>-->
                <span class="span_2">课程类型：
                    <span th:if="${cou.type==0}">证书课程</span>
                    <span th:if="${cou.type==1}">师资培训课程</span>
                    <span th:if="${cou.type==2}">考评员培训课程</span>
                    <span th:if="${cou.type==3}">高级师资培训课程</span>
                    <span th:if="${cou.type==4}">高级考评员培训课程</span>
                </span>
                <span class="span_2">讲师名：<span th:text="${cou.teacherName}"></span></span>
            </div>
            <div style="clear: both"></div>
        </div>
        <div class="div_2">
            <div style="display:flex;height: 50px">
                <span class="span_3 active1">课程简介</span>
                <span class="span_3">课程内容</span>
                <span class="span_3">配套资源</span>
                <span class="span_3">章节练习</span>
                <span class="span_3">课程测试</span>
                <span class="span_3" id="CoursesTasks">课后作业</span>
                <span class="span_3">课程疑问讨论区</span>
            </div>
            <hr style="margin: auto"/>
            <!-- 课程简介 -->
            <div style="font-size: 14px;  margin: 30px;" id="introduce">
                <p style="font-size: 14px;" th:if="${not #strings.isEmpty(cou.introduce)}" th:text="${cou.introduce}"></p>
                <p style="font-size: 14px;" th:if="${#strings.isEmpty(cou.introduce)}">暂无数据</p>
            </div>
            <!-- 课程内容 -->
            <div style="font-size: 14px; margin:20px 0;display: none" id="chapterList">
                <input id="selChapterListFirst" type="hidden" th:value="${selChapterList.size()>0?selChapterList[0].id:''}"/>
                <input id="selChapterList" type="hidden" th:value="${selChapterList}"/>
                <th:block >
                    <th:block th:each="item,loopStatus : ${selChapterList}" >
                        <th:block  th:with="chapterId=${item.id}" >
                            <div class="list" style="display: flex;flex-direction: row;align-items: center; background: #e8f9ff;margin-top: 20px;">
                                <div th:id="'icon_'+${chapterId}" style="margin-right: 2px">
                                    <i th:if="${loopStatus.count}==1" class="layui-icon layui-icon-down" aria-hidden="true"></i>
                                    <i th:if="${loopStatus.count}!=1" class="layui-icon layui-icon-right" aria-hidden="true"></i>
                                </div>
                                <span th:onclick="'javascript:ShrinkChapter(\''+${item.id}+'\')'" class="chapterTitle" th:style="'margin-left:' + ${item.level*30}+'px;width: '+${100-(item.level*3)}+'%;font-size: 16px; background: #e8f9ff;color: #666;'" th:text="${item.name}" ></span>
                                <div style="width: 50%;overflow: hidden;display: flex;flex-direction: row;align-items: center;justify-content: flex-end">

                                    <th:block  th:if="${item.isHaveResources}==1">
                                        <th:block th:each="res : ${item.resources}" >
                                            <a th:href="'/couInfo/couInfo/trainingResourcesDetails?id='+${item.id}+'&resourceId='+${res.id}+'&rindex='+${res.rindex}" target="_blank">
                                                <th:block  th:if="${res.type}==0">
                                                    <i class="iconfont icon-wendang" aria-hidden="true" style="margin-right: 30px;color: #d6204b;font-size: 20px;"></i>
                                                </th:block>
                                                <th:block  th:if="${res.type}==1">
                                                    <i class="iconfont icon-icon-test" aria-hidden="true" style="margin-right: 30px;color: #f68859;font-size: 20px;"></i>
                                                </th:block>
                                                <th:block  th:if="${res.type}==2">
                                                    <i class="iconfont icon-ppt" aria-hidden="true" style="margin-right: 30px;color: #f68859;font-size: 20px;"></i>
                                                </th:block>
                                                <th:block  th:if="${res.type}==3">
                                                    <i class="layui-icon layui-icon-file" aria-hidden="true" style="margin-right: 30px"></i>
                                                </th:block>
                                                <th:block  th:if="${res.type}==4">
                                                    <i class="iconfont icon-icon-test1" aria-hidden="true" style="margin-right: 30px;color: #f68859;font-size: 20px;"></i>
                                                </th:block>
                                                <th:block  th:if="${res.type}==5">
                                                    <i class="iconfont icon-icon-test" aria-hidden="true" style="margin-right: 30px;color: #f68859;font-size: 20px;"></i>
                                                </th:block>
                                            </a>
                                        </th:block>
                                    </th:block>

                                </div>
                            </div>
                            <div style=" margin:20px 0;display: none" th:class="'chapter_'+${chapterId}" th:name="'chapter_'+${chapterId}" th:id="'chapter_'+${chapterId}" >
                                <th:block  th:if="${item.isHaveChildren+''=='1'}" th:with="titleFontSize=15">
                                    <th:block th:each="item2 : ${item.children}" >
                                        <th:block >
                                            <div class="list" style="margin-top: 10px;">
                                                <div  class="chapterTitle"  th:style="'margin-left:' + ${item2.level*30}+'px;width: '+${100-(item2.level*3)}+'%;font-size: '+${titleFontSize}+'px;color: #666;display: flex;justify-content: space-between;flex-direction: row;align-items: center; background: #ffffff;'">
                                                    <span  th:text="${item2.name}"></span>
                                                    <div class="chapterIcon">
                                                        <th:block  th:if="${item2.isHaveResources}==1">
                                                            <th:block th:each="res2 : ${item2.resources}" >
                                                                <a th:href="'/couInfo/couInfo/trainingResourcesDetails?id='+${item2.id}+'&resourceId='+${res2.id}+'&rindex='+${res2.rindex}" target="_blank">
                                                                    <th:block  th:if="${res2.type}==0">
                                                                        <i class="iconfont icon-wendang" aria-hidden="true" style="margin-right: 30px;color: #f68859;font-size: 20px;"></i>
                                                                    </th:block>
                                                                    <th:block  th:if="${res2.type}==1">
                                                                        <i class="iconfont icon-icon-test" aria-hidden="true" style="margin-right: 30px;color: #f68859;font-size: 20px;"></i>
                                                                    </th:block>
                                                                    <th:block  th:if="${res2.type}==2">
                                                                        <i class="iconfont icon-ppt" aria-hidden="true" style="margin-right: 30px;color: #f68859;font-size: 20px;"></i>
                                                                    </th:block>
                                                                    <th:block  th:if="${res2.type}==3">
                                                                        <i class="layui-icon layui-icon-file" aria-hidden="true" style="margin-right: 30px"></i>
                                                                    </th:block>
                                                                    <th:block  th:if="${res2.type}==4">
                                                                        <i class="iconfont icon-icon-test1" aria-hidden="true" style="margin-right: 30px;color: #f68859;font-size: 20px;"></i>
                                                                    </th:block>
                                                                    <th:block  th:if="${res2.type}==5">
                                                                        <i class="iconfont icon-icon-test" aria-hidden="true" style="margin-right: 30px;color: #f68859;font-size: 20px;"></i>
                                                                    </th:block>
                                                                </a>
                                                            </th:block>
                                                        </th:block>
                                                    </div>
                                                </div>
                                            </div>
                                            <th:block  th:if="${item2.isHaveChildren+''=='1'}" th:with="titleFontSize=14">
                                                <th:block th:each="item3 : ${item2.children}" >
                                                    <th:block >
                                                        <div class="list" style="color: #666;margin-top: 10px;" >
                                                            <div  class="chapterTitle"  th:style="'margin-left:' + ${item3.level*30}+'px;width: '+${100-(item3.level*3)}+'%;font-size: '+${titleFontSize}+'px;color: #666;display: flex;justify-content: space-between;flex-direction: row;align-items: center; background: #ffffff;'" >
                                                                <span th:text="${item3.name}"></span>
                                                                <div class="chapterIcon">
                                                                    <th:block  th:if="${item3.isHaveResources}==1">
                                                                        <th:block th:each="res3 : ${item3.resources}" >
                                                                            <a th:href="'/couInfo/couInfo/trainingResourcesDetails?id='+${item3.id}+'&resourceId='+${res3.id}+'&rindex='+${res3.rindex}" target="_blank">
                                                                                <th:block  th:if="${res3.type}==0">
                                                                                    <i class="iconfont icon-wendang" aria-hidden="true" style="margin-right: 30px;color: #f68859;font-size: 20px;"></i>
                                                                                </th:block>
                                                                                <th:block  th:if="${res3.type}==1">
                                                                                    <i class="iconfont icon-icon-test" aria-hidden="true" style="margin-right: 30px;color: #f68859;font-size: 20px;"></i>
                                                                                </th:block>
                                                                                <th:block  th:if="${res3.type}==2">
                                                                                    <i class="iconfont icon-ppt" aria-hidden="true" style="margin-right: 30px;color: #f68859;font-size: 20px;"></i>
                                                                                </th:block>
                                                                                <th:block  th:if="${res3.type}==3">
                                                                                    <i class="layui-icon layui-icon-file" aria-hidden="true" style="margin-right: 30px"></i>
                                                                                </th:block>
                                                                                <th:block  th:if="${res3.type}==4">
                                                                                    <i class="iconfont icon-icon-test1" aria-hidden="true" style="margin-right: 30px;color: #f68859;font-size: 20px;"></i>
                                                                                </th:block>
                                                                                <th:block  th:if="${res3.type}==5">
                                                                                    <i class="iconfont icon-icon-test" aria-hidden="true" style="margin-right: 30px;color: #f68859;font-size: 20px;"></i>
                                                                                </th:block>
                                                                            </a>
                                                                        </th:block>
                                                                    </th:block>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </th:block>
                                                </th:block>
                                            </th:block>
                                        </th:block>
                                    </th:block>
                                </th:block>
                            </div>
                        </th:block>
                    </th:block>
                </th:block>
            </div>
            <!-- 配套资源 -->
            <div style="font-size: 14px; margin:30px;display: none" id="extendList">
            </div>
            <!-- 章节练习 -->
            <div style="font-size: 14px; margin:30px;display: none" id="chapterText">
            </div>
            <!-- 课程测试 -->
            <div style="font-size: 14px; margin:30px;display: none" id="couText">
                <a style="float: left;margin-right: 10px" th:href="@{'/cultivate/study/studyExam?id='+${cou.id}+'&type=0&isTestScores='+${isTestScores}}" class="uc-ykt-course-card_btn">开始练习</a>
                <a style="float: left" th:if="${isTestScores!='1'}" th:href="@{'/cultivate/study/studyExam?id='+${cou.id}+'&type=1&isTestScores='+${isTestScores}}" class="uc-ykt-course-card_btn">开始测试</a>
                <a style="float: left" th:if="${isTestScores=='1'}" class="uc-ykt-course-card_btn_false">已完成测试,不可重复测试</a>
                <div style="clear: both"></div>
                <div style="color:red;font-size:16px;margin-top:20px">注意：练习时长和测试成绩会记录</div>
            </div>
            <!-- 课后作业 -->
            <div style="font-size: 14px; margin:30px;display: none" id="courseAndTask">

                <!--<div class="list" style="display: flex;flex-direction: row;align-items: center; background: #f7f7f7;border-bottom: 1px solid #edfdff; margin-top: 20px;">
                    <div onclick="ShrinkTask('123')" class="dis_row a_center" style="width: 80%;">
                        &lt;!&ndash;<div id="icon_123" style="margin-right: 2px">
                            <i id="icon_down_123" class="layui-icon layui-icon-down" aria-hidden="true" style="display: none;font-size: 16px;"></i>
                            <i id="icon_right_123" class="layui-icon layui-icon-right" aria-hidden="true" style="font-size: 16px;"></i>
                        </div>&ndash;&gt;
                        <span class="chapterTitle" style="font-weight:normal;width: auto; background: #f7f7f7;">作业一</span>
                        <span class="chapterTitle" style="font-weight:normal;font-size: 14px;color: #999;margin-left: 30px;width: auto; background: #f7f7f7;">开始时间：2021年7月12日 - 截止时间：2021年8月12日</span>
                        <span class="chapterTitle" style="font-weight:normal;font-size: 14px;color: red;width: auto; background: #f7f7f7;">(已截止)</span>
                    </div>
                    <div class="dis_row a_center" style="width: 20%;justify-content: flex-end;">
                        <div class="discuss_buttons_send dis_row a_center j_center " >
                            查看作业
                        </div>
                    </div>
                </div>-->
                <div id="courseAndTaskList" class="list" style="border-bottom: 1px solid #edfdff; margin-top: 20px;">

                </div>
                <div id="courseAndTaskDetails" class="list" style="border-bottom: 1px solid #edfdff; margin-top: 20px;display: none;">

                </div>
            </div>
            <!-- 课程疑问讨论区 -->
            <div style="display: none" id="courseAndAsk">
                <input type="hidden" id="coursesId" name="coursesId" th:value="${coursesId}"/>
                <input type="hidden" id="rootId" name="rootId" value="-1"/>
                <!--<div class="list dis_column discuss_top" >
                       <div class="dis_row a_center discuss_top_title">
                           <span style="width: 80%;font-size: 18px;">讨论区</span>
                           <span style="width: 20%;color: #fe7252;font-size: 12px;">讨论区使用规则</span>
                       </div>
                      <div class="dis_row a_center discuss_top_content">
                           欢迎进入课程讨论区! ......
                       </div>
                   </div>-->
                <div id="sendMessageDiv" class="dis_column a_center discuss_buttons" style="margin-top: 10px;">
                    <div id="messageDiv"  class="dis_row a_center j_center discuss_buttons_textarea" style="border: 1px solid #ccc;border-radius: 4px;margin-top: 20px">
                                    <textarea id="message"  name="message" placeholder="留下你的评论..."
                                              style="text-align: start; border: 0;width: 98%;height: 80px; resize: none;"
                                    ></textarea>
                    </div>
                    <div class="dis_row a_center j_center discuss_buttons_textarea" style="margin-top: 5px;border:0;background-color: #f5f5f5;">
                        <div style="width: 80%;"  class=" dis_row a_center">
                            <input type="checkbox" id="isAnonymous" name="isAnonymous"/><label style="margin-left: 5px;color: #666">匿名</label>
                        </div>
                        <div  style="width: 20%;justify-content: flex-end;" class=" dis_row a_center">
                            <div onclick="toSendMessage(-1)" class="discuss_buttons_send dis_row a_center j_center ">
                                发布
                            </div>
                        </div>
                    </div>
                </div>

                <div style="font-size: 14px; margin:0px;" id="courseAsk">
                    <div id="commentListDiv" style="width: 100%;">
                        <!--<div class="dis_row a_center j_center discuss_buttons_textarea" style="margin-top: 5px;width: 200px;height: 80px;background-color: #fff; border:0;border-bottom: 3px solid #22ac38;font-size: 18px;">
                            当前评论数：0
                        </div>
                        <div style="margin-top: 50px;"></div>
                        <div id="commentList" class="dis_column a_center j_center discuss_list" style="height: auto;">
                            <div class="discuss_list dis_column a_center j_center">
                                <div class="dis_row a_center discuss_list" style="height: 80px;width: 82%;">
                                    <div class="dis_row a_center discuss_list" style="width: 80px;">
                                        <img src="https://jinzhiweiye.oss-cn-hangzhou.aliyuncs.com/2021/05/31/45b046178c554ac98dfaa796a549aa7c222.jpg" style="height: 50px;width: 50px;border-radius: 50px;">
                                    </div>
                                    <div class="dis_row a_center discuss_list" style="height: 80px;width: auto;margin-left: 7px;color: #000;">
                                        e123456
                                    </div>
                                    <div class="dis_row a_center j_center discuss_list" style="height: 35px;width: 80px;margin-left: 7px;color: #fe490a;border: 1px solid #fe490a;border-radius: 4px;">
                                        讲师
                                    </div>
                                    &lt;!&ndash;<div class="dis_row a_center j_center discuss_list" style="height: 35px;width: 80px;margin-left: 7px;color: #ffffff;background-color: #fe7252;border-radius: 4px;">
                                        讲师
                                    </div>
                                    <div class="dis_row a_center j_center discuss_list" style="height: 35px;width: 80px;margin-left: 7px;color: #ffffff;background-color:  #fe9157;border-radius: 4px;">
                                        学生
                                    </div>&ndash;&gt;
                                </div>
                                <div class="dis_row a_center j_center discuss_list" style="height: auto;width: 82%;">
                                    <div class="dis_row a_center discuss_list" style="width: 90%;margin-left: 10%;">
                                        e123456544444444444444444444444444444444444444444444444444123
                                    </div>
                                </div>
                                <div class="dis_row a_center j_center discuss_list" style="height: 1px;background-color: #E2E2E2;margin-top: 20px; margin-bottom: 20px;"></div>
                                <div class="dis_column j_center discuss_list" style="width: 70%;height: 100px;margin-left: 15%;background-color: #f5f5f5;">
                                    <div class="dis_row a_center j_center discuss_list" style="height: 80px;background-color: #f5f5f5;">
                                        <div class="dis_row a_center discuss_list" style="height: 80px;width: auto;margin-left: 10px;color: #000;background-color: #f5f5f5;">
                                            e123456:
                                        </div>
                                        <div class="dis_row a_center discuss_list" style="width: 90%;height: 80px;margin-left: 7px;overflow: hidden;background-color: #f5f5f5;">
                                            e123456544444444444444444444444444444444444444444444444444123e123456544444444444444444444444444444444444444444444444444123
                                        </div>
                                    </div>
                                </div>

                                <div class="dis_row a_center j_center discuss_list" style="height: 80px;width: 82%;">
                                    <div class="dis_row a_center discuss_list" style="height: 80px;width: 50%;">
                                        16小时前
                                    </div>
                                    <div class="dis_row a_center discuss_list" style="height: 80px;width: 50%;justify-content: flex-end;">
                                        <span>删除</span>
                                        <span style="margin-left: 10px;">回复(152)</span>
                                        <span style="margin-left: 10px;">...</span>
                                    </div>
                                </div>
                                <div class="dis_row a_center j_center discuss_list" style="height: 10px;background-color: #f7f7f7; "></div>
                            </div>
                            <div class="discuss_list dis_column a_center j_center">
                                <div class="dis_row a_center discuss_list" style="height: 80px;width: 82%;">
                                    <div class="dis_row a_center discuss_list" style="width: 80px;">
                                        <img src="https://jinzhiweiye.oss-cn-hangzhou.aliyuncs.com/2021/05/31/45b046178c554ac98dfaa796a549aa7c222.jpg" style="height: 50px;width: 50px;border-radius: 50px;">
                                    </div>
                                    <div class="dis_row a_center discuss_list" style="height: 80px;width: auto;margin-left: 7px;color: #000;">
                                        e123456
                                    </div>
                                    <div class="dis_row a_center j_center discuss_list" style="height: 35px;width: 80px;margin-left: 7px;color: #fe490a;border: 1px solid #fe490a;border-radius: 4px;">
                                        讲师
                                    </div>
                                </div>
                                <div class="dis_row a_center j_center discuss_list" style="height: auto;width: 82%;">
                                    <div class="dis_row a_center discuss_list" style="width: 90%;margin-left: 10%;">
                                        e123456544444444444444444444444444444444444444444444444444123
                                    </div>
                                </div>
                                &lt;!&ndash;<div class="dis_row a_center j_center discuss_list" style="height: 1px;background-color: #E2E2E2;margin-top: 20px; "></div>&ndash;&gt;
                                <div class="dis_row a_center j_center discuss_list" style="height: 80px;width: 82%;">
                                    <div class="dis_row a_center discuss_list" style="height: 80px;width: 50%;">
                                        16小时前
                                    </div>
                                    <div class="dis_row a_center discuss_list" style="height: 80px;width: 50%;justify-content: flex-end;">
                                        <span>删除</span>
                                        <span style="margin-left: 10px;">回复(152)</span>
                                        <span style="margin-left: 10px;">...</span>
                                    </div>
                                </div>
                                <div class="dis_row a_center j_center discuss_list" style="height: 10px;background-color: #f7f7f7; "></div>
                            </div>
                        </div>

                        <div class="discuss_list dis_column a_center j_center">
                            <div class="dis_row a_center discuss_list" style="height: 80px;width: 82%;">
                                <div class="dis_row a_center discuss_list" style="width: 80px;">
                                    <img src="https://jinzhiweiye.oss-cn-hangzhou.aliyuncs.com/2021/05/31/45b046178c554ac98dfaa796a549aa7c222.jpg" style="height: 50px;width: 50px;border-radius: 50px;">
                                </div>
                                <div class="dis_row a_center discuss_list" style="height: 80px;width: auto;margin-left: 7px;color: #000;">
                                    e123456
                                </div>
                                <div class="dis_row a_center j_center discuss_list" style="height: 35px;width: 80px;margin-left: 7px;color: #fe9157;border: 1px solid #fe9157;border-radius: 4px;">
                                    学生
                                </div>
                                <div class="dis_row a_center j_center discuss_list" style="height: auto;width: auto;margin-left: 7px;color: #999;background-color: #e8f9ff;border-radius: 4px;padding: 5px 5px;">
                                    123456班
                                </div>
                            </div>
                            <div class="dis_row a_center j_center discuss_list" style="height: auto;width: 82%;">
                                <div class="dis_row a_center discuss_list" style="width: 90%;margin-left: 10%;">
                                    e123456544444444444444444444444444444444444444444444444444123
                                </div>
                            </div>
                            &lt;!&ndash;<div class="dis_row a_center j_center discuss_list" style="height: 1px;background-color: #E2E2E2;margin-top: 20px; "></div>&ndash;&gt;
                            <div class="dis_row a_center j_center discuss_list" style="height: 80px;width: 82%;">
                                <div class="dis_row a_center discuss_list" style="height: 80px;width: 50%;">
                                    16小时前
                                </div>
                                <div class="dis_row a_center discuss_list" style="height: 80px;width: 50%;justify-content: flex-end;">
                                    <span>删除</span>
                                    <span style="margin-left: 10px;">回复(152)</span>
                                    <span style="margin-left: 10px;">...</span>
                                </div>
                            </div>
                            <div class="dis_row a_center j_center discuss_list" style="height: 10px;background-color: #f7f7f7; "></div>
                        </div>
                    -->
                    </div>

                    <div id="subCommentListDiv" style="width: 100%;">

                    </div>
                </div>

                <!--<div class="ibox-content no-padding">
                    <div id="content_sn" class="summernote" style="width: 600px;height: 500px;"></div>
                </div>-->
                <!--<div id="page" class="page"></div>-->
            </div>
        </div>
    </section>
        </div>
    </div>
    <div style="display: none;margin-top: 25px" id="coursePanel">
        <span class="q_Info">Q：<span id="ques"></span></span>
        <span class="q_Info">A：<span id="ans"></span></span>
    </div>

</div>

<!-- footer ------------------------------------------------------- -->
<div class="footer" th:include="cultivateWeb/header :: footer"></div>
</body>
<script type="text/javascript" src="/js/xlPaging.js"></script>
<script>
    let CommentList = [];
    let rootItem = [];
    let items = {};
    $(function () {
        var is_mobi = navigator.userAgent.toLowerCase().match(/(ipod|iphone|android|coolpad|mmp|smartphone|midp|wap|xoom|symbian|j2me|blackberry|wince)/i) != null;
        if(is_mobi){
            $(".span_3").css({"font-size":"12px"});
            // $(".list .chapterTitle").css({"font-size":"16px"})
        }
        $(".span_3").click(function () {
            $(this).addClass("active1");
            $(this).siblings().removeClass("active1");
            if ($(this).text() == '课程简介') {
                $("#introduce").show();
                $("#chapterList").hide();
                $("#extendList").hide();
                $("#chapterText").hide();
                $("#couText").hide();
                $('#courseAndTask').hide();
                $('#courseAndAsk').hide();
            }else if($(this).text() == '课程内容') {
                $("#introduce").hide();
                $("#chapterList").show();
                $("#extendList").hide();
                $("#chapterText").hide();
                $("#couText").hide();
                $('#courseAndTask').hide();
                $('#courseAndAsk').hide();
            }else if($(this).text() == '配套资源') {
                $("#introduce").hide();
                $("#chapterList").hide();
                $("#extendList").show();
                $("#chapterText").hide();
                $("#couText").hide();
                $('#courseAndTask').hide();
                $('#courseAndAsk').hide();
            }else if($(this).text() == '章节练习') {
                $("#introduce").hide();
                $("#chapterList").hide();
                $("#extendList").hide();
                $("#chapterText").show();
                $("#couText").hide();
                $('#courseAndTask').hide();
                $('#courseAndAsk').hide();
            }  else if ($(this).text() == '课程测试') {
                $("#introduce").hide();
                $("#chapterList").hide();
                $("#extendList").hide();
                $("#chapterText").hide();
                $("#couText").show();
                $('#courseAndTask').hide();
                $('#courseAndAsk').hide();
            }else if($(this).text() == '课后作业'){
                getCourseTasks();
                $("#introduce").hide();
                $("#chapterList").hide();
                $("#extendList").hide();
                $("#chapterText").hide();
                $("#couText").hide();
                $('#courseAndTask').show();
                $('#courseAndAsk').hide();

            }else {
                getCommentList();
                $("#introduce").hide();
                $("#chapterList").hide();
                $("#extendList").hide();
                $("#chapterText").hide();
                $("#couText").hide();
                $('#courseAndTask').hide();
                $('#courseAndAsk').show();
            }
        });

        let taskId = $("#taskId").val();
       // console.log("taskId:"+taskId);
        if(taskId!=undefined && taskId != '' && taskId != 'undefined'){
            $(".span_3").siblings().removeClass("active1");
            $("#CoursesTasks").addClass("active1");
            getCourseTasks();
            $("#introduce").hide();
            $("#chapterList").hide();
            $("#extendList").hide();
            $("#chapterText").hide();
            $("#couText").hide();
            $('#courseAndTask').show();
            $('#courseAndAsk').hide();

            toLookTask(taskId)
        }
        selExtendList();
        //selChapterList();
        //questions();
    });

    function getCourseTasks(){
        //console.log("classId:"+$("#classId").val());
       // console.log("courseId:"+$("#courseId").val());
        ajaxToken("/jzApi/courses/selCourseAndTask", 'POST',
            {
                current:1,
                number:10,
                classId: $("#classId").val(),
                courseId: $("#courseId").val(),
            },function (res) {
                if (res.data == 0) {
                    $("#courseAndTask").html('<div class="noData">暂无数据</div>');
                } else {
                   //console.log("res:"+JSON.stringify(res));
                    var list = res.records;
                    let str='';
                    list.forEach(function (item, index) {
                       // let startTime=item.startTime.format("yyyy年MM月dd日");
                        //let endTime=item.endTime.format("yyyy年MM月dd日");
                        str +='             <div class="list" style="display: flex;flex-direction: row;align-items: center; background: #f7f7f7;border-bottom: 1px solid #edfdff; margin-top: 20px;">\n' +
                            '                    <div class="dis_row a_center" style="width: 80%;">\n' +
                            '                        <div id="icon_123" style="margin-right: 2px">\n' +
                            '                            <i id="icon_down_123" class="layui-icon layui-icon-down" aria-hidden="true" style="display: none;font-size: 16px;"></i>\n' +
                            '                            <i id="icon_right_123" class="layui-icon layui-icon-right" aria-hidden="true" style="font-size: 16px;"></i>\n' +
                            '                        </div>\n' +
                            '                        <span class="chapterTitle" style="font-weight:normal;width: auto; background: #f7f7f7;">作业一</span>\n' +
                            '                        <span class="chapterTitle" style="font-weight:normal;font-size: 14px;color: #999;margin-left: 30px;width: auto; background: #f7f7f7;">开始时间：'+item.startTimeStr+' - 截止时间：'+item.endTimeStr+'</span>\n';
                        if(item.isOver==1){
                            str +='                  <span class="chapterTitle" style="font-weight:normal;font-size: 14px;color: red;width: auto; background: #f7f7f7;">(已截止)</span>\n';
                        }
                        str +='                    </div>\n' +
                            '                    <div class="dis_row a_center" style="width: 20%;justify-content: flex-end;">\n' +
                              //  '                    <a href="/cultivate/study/taskInfo?id=' + item2.id +'&chapterId='+item2.chapterId+ '&courseId=' + $("#courseId").val() + '">'+
                            '                           <div onclick="toLookTask(\''+item.id+'\')" class="discuss_buttons_send dis_row a_center j_center " >\n' +
                            '                                查看作业\n' +
                            '                            </div>\n' +
                           // '                        </a>' +
                            '                    </div>\n' +
                            '                </div>';
                    });
                    $("#courseAndTaskList").html(str);
                }
            }
        )
    }


    function toLookTask(id) {
        ajaxToken("/jzApi/courses/selTaskInfo", 'POST',
            {
                id: id
            },function (res) {
                //console.log("res:"+res);
               // console.log("res:"+JSON.stringify(res));
                if (res.data == 0) {
                    $("#courseAndTaskDetails").html('<div class="noData">暂无数据</div>');
                } else {
                    let disableStr = '';
                    let showGetScore = false;
                    let data = res;
                    items = res;
                    let detailsStr = '<div class="list">\n' +
                        '    <div class="list dis_row a_center" style="border-bottom: 1px solid #edfdff;height: 50px;">\n' +
                        '        <div class="list dis_row a_center" style="background-color: #fff;width: 33%;height: 100%;">\n' +
                        '            <h2 style="margin-left: 10px;color: #666;">作业</h2>\n' +
                        '        </div>\n' +
                        '        <div class="list dis_row a_center" style="background-color: #fff;width: 51%;height: 100%;justify-content: flex-end;">\n';
                    //console.log("items.isOver:"+items.isOver);
                    if(items.isOver == 0 && (items.submitId == '' || (items.submitId != '' && items.submitStatus == 0))){
                        detailsStr+='<div onclick="stubmitTasksAswer(0)" class="discuss_buttons_send dis_row a_center j_center ">\n' +
                        '                暂存作业\n' +
                        '             </div>\n' ;
                        detailsStr+='<div onclick="stubmitTasksAswer(1)" class="discuss_buttons_send dis_row a_center j_center " style="margin-left: 20px;">\n' +
                        '                提交作业\n' +
                        '            </div>\n';
                    }else {
                        disableStr = ' disabled="disabled"';
                        showGetScore = true;
                    }


                    detailsStr+='</div>\n' +
                        '        <div class="list dis_row a_center" style="background-color: #ffffff;width: 15%;height: 100%;justify-content: flex-end;">\n' +
                        '            <h2 onclick="returnTaskList()" style="margin-left: 10px;color: #999;">\n' +
                        '                返回\n' +
                        '            </h2>\n' +
                        '        </div>\n' +
                        '    </div>\n';
                    let number = 0;
                    if(data.itmsType0Num>0){
                        detailsStr +=
                            '    <div class="list dis_row a_center" style="border-bottom: 1px solid #f7f7f7;height: 50px;margin-top: 20px;">\n' +
                            '        <div class="list dis_row a_center" style="background-color: #f7f7f7;width: 100%;height: 100%;">\n' +
                            '            <h2 style="margin-left: 10px;color: #000;">单选题</h2>\n' +
                            '            <span style="font-size: 14px;color: #999;margin-left: 10px;">共</span>\n' +
                            '            <span style="font-size: 14px;color: #999;">'+data.itmsType0Num+'</span>\n' +
                            '            <span style="font-size: 14px;color: #999;">题</span>\n' +
                            '        </div>\n' +
                            '    </div>\n';
                        data.itmsType0.forEach(function (item, index) {
                            number+=1;
                            detailsStr +=
                                '    <div class="list dis_row a_center" style="border-bottom: 1px solid #f7f7f7;height: 50px;margin-top: 20px;">\n' +
                                '        <div class="list dis_row a_center" style="width: 100%;height: 100%;">\n' +
                                '            <h3 style="margin-left: 10px;color: #666;line-height: 20px;">'+ number +'.&nbsp;&nbsp;'+item.topic_content+' &nbsp;<span style="color:green;">分值（'+item.score+'分）</span>';
                            if(showGetScore) {
                                detailsStr +='<span style="color:red;">得分（' + item.getScore + '分）</span>';
                            }
                            detailsStr +='  </h3>\n' +
                                '        </div>\n' +
                                '    </div>\n';
                            if(item.children.length>0){
                                item.children.forEach(function (item2, index2) {
                                    detailsStr +=
                                        '    <div class="list dis_row a_center" style="border-bottom: 1px solid #f7f7f7;height: 50px;margin-top: 20px;">\n' +
                                        '        <div class="list dis_row a_center" style="width: 100%;height: 100%;">\n';
                                    if(item2.selected==1){
                                    detailsStr +=
                                        '            <input style="margin-left: 40px;" type="radio" '+ disableStr +' onchange="changeValue(\'itmsType0\',\''+item2.value+'\','+index+ ',' + index2 + ',\'itmsType0_'+index+'\')" name="itmsType0_'+index+'" value="'+item2.value+'" checked="checked"/><label style="margin-left: 20px;">'+item2.value+'</label>';
                                    }else  if(item2.selected==0){
                                        detailsStr +=
                                            '        <input style="margin-left: 40px;" type="radio" '+ disableStr +'  onchange="changeValue(\'itmsType0\',\''+item2.value+'\','+index+ ',' + index2 + ',\'itmsType0_'+index+'\')" name="itmsType0_'+index+'" value="'+item2.value+'"/><label style="margin-left: 20px;">'+item2.value+'</label>';
                                    }
                                    detailsStr +=
                                        '        </div>\n' +
                                        '    </div>\n';
                                });
                            }
                        });
                    }
                    if(data.itmsType1Num>0){
                        detailsStr +=
                            '    <div class="list dis_row a_center" style="border-bottom: 1px solid #f7f7f7;height: 50px;margin-top: 20px;">\n' +
                            '        <div class="list dis_row a_center" style="background-color: #f7f7f7;width: 100%;height: 100%;">\n' +
                            '            <h2 style="margin-left: 10px;color: #000;">多选题</h2>\n' +
                            '            <span style="font-size: 14px;color: #999;margin-left: 10px;">共</span>\n' +
                            '            <span style="font-size: 14px;color: #999;">'+data.itmsType1Num+'</span>\n' +
                            '            <span style="font-size: 14px;color: #999;">题</span>\n' +
                            '        </div>\n' +
                            '    </div>\n';
                        data.itmsType1.forEach(function (item, index) {
                            number+=1;
                            detailsStr +=
                                '    <div class="list dis_row a_center" style="border-bottom: 1px solid #f7f7f7;height: 50px;margin-top: 20px;">\n' +
                                '        <div class="list dis_row a_center" style="width: 100%;height: 100%;">\n' +
                                '            <h3 style="margin-left: 10px;color: #666;line-height: 20px;">'+ number +'.&nbsp;&nbsp;'+item.topic_content+' &nbsp;<span style="color:green;">分值（'+item.score+'分）</span>';
                            if(showGetScore) {
                                detailsStr +='<span style="color:red;">得分（' + item.getScore + '分）</span>';
                            }
                            detailsStr +='</h3>\n' +
                                '        </div>\n' +
                                '    </div>\n';
                            if(item.children.length>0){
                                item.children.forEach(function (item2, index2) {
                                    detailsStr +=
                                        '    <div class="list dis_row a_center" style="border-bottom: 1px solid #f7f7f7;height: 50px;margin-top: 20px;">\n' +
                                        '        <div class="list dis_row a_center" style="width: 100%;height: 100%;">\n';
                                    if(item2.selected==1){
                                        detailsStr +=
                                            '            <input style="margin-left: 40px;" type="checkbox" '+ disableStr +'  onchange="changeValue(\'itmsType1\',\''+item2.value+'\','+index+ ',' + index2 + ',\'itmsType1_'+index+'\')" name="itmsType1_'+index+'" value="'+item2.value+'" checked="checked"/><label style="margin-left: 20px;">'+item2.value+'</label>';
                                    }else  if(item2.selected==0){
                                        detailsStr +=
                                            '        <input style="margin-left: 40px;" type="checkbox" '+ disableStr +'  onchange="changeValue(\'itmsType1\',\''+item2.value+'\','+index+ ',' + index2 + ',\'itmsType1_'+index+'\')" name="itmsType1_'+index+'" value="'+item2.value+'"/><label style="margin-left: 20px;">'+item2.value+'</label>';
                                    }
                                    detailsStr +=
                                        '        </div>\n' +
                                        '    </div>\n';
                                });
                            }
                        });
                    }
                    if(data.itmsType2Num>0){
                        detailsStr +=
                            '    <div class="list dis_row a_center" style="border-bottom: 1px solid #f7f7f7;height: 50px;margin-top: 20px;">\n' +
                            '        <div class="list dis_row a_center" style="background-color: #f7f7f7;width: 100%;height: 100%;">\n' +
                            '            <h2 style="margin-left: 10px;color: #000;">判断题</h2>\n' +
                            '            <span style="font-size: 14px;color: #999;margin-left: 10px;">共</span>\n' +
                            '            <span style="font-size: 14px;color: #999;">'+data.itmsType2Num+'</span>\n' +
                            '            <span style="font-size: 14px;color: #999;">题</span>\n' +
                            '        </div>\n' +
                            '    </div>\n';
                        data.itmsType2.forEach(function (item, index) {
                            number+=1;
                            detailsStr +=
                                '    <div class="list dis_row a_center" style="border-bottom: 1px solid #f7f7f7;height: 50px;margin-top: 20px;">\n' +
                                '        <div class="list dis_row a_center" style="width: 100%;height: 100%;">\n' +
                                '            <h3 style="margin-left: 10px;color: #666;line-height: 20px;">'+ number +'.&nbsp;&nbsp;'+item.topic_content+' &nbsp;<span style="color:green;">分值（'+item.score+'分）</span>';
                            if(showGetScore) {
                                detailsStr +='<span style="color:red;">得分（' + item.getScore + '分）</span>';
                            }
                            detailsStr +='</h3>\n' +
                                '        </div>\n' +
                                '    </div>\n';
                            if(item.children.length>0){
                                item.children.forEach(function (item2, index2) {
                                    detailsStr +=
                                        '    <div class="list dis_row a_center" style="border-bottom: 1px solid #f7f7f7;height: 50px;margin-top: 20px;">\n' +
                                        '        <div class="list dis_row a_center" style="width: 100%;height: 100%;">\n';
                                    if(item2.selected==1){
                                        detailsStr +=
                                            '            <input style="margin-left: 40px;" type="radio" '+ disableStr +'  onchange="changeValue(\'itmsType2\',\''+item2.value+'\','+index+ ',' + index2 + ',\'itmsType2_'+index+'\')" name="itmsType2_'+index+'" value="'+item2.value+'" checked="checked"/><label style="margin-left: 20px;">'+item2.value+'</label>';
                                    }else  if(item2.selected==0){
                                        detailsStr +=
                                            '        <input style="margin-left: 40px;" type="radio" '+ disableStr +'  onchange="changeValue(\'itmsType2\',\''+item2.value+'\','+index+ ',' + index2 + ',\'itmsType2_'+index+'\')" name="itmsType2_'+index+'" value="'+item2.value+'"/><label style="margin-left: 20px;">'+item2.value+'</label>';
                                    }
                                    detailsStr +=
                                        '        </div>\n' +
                                        '    </div>\n';
                                });
                            }
                        });
                    }
                    if(data.itmsType3Num>0){
                        detailsStr +=
                            '    <div class="list dis_row a_center" style="border-bottom: 1px solid #f7f7f7;height: 50px;margin-top: 20px;">\n' +
                            '        <div class="list dis_row a_center" style="background-color: #f7f7f7;width: 100%;height: 100%;">\n' +
                            '            <h2 style="margin-left: 10px;color: #000;">填空题</h2>\n' +
                            '            <span style="font-size: 14px;color: #999;margin-left: 10px;">共</span>\n' +
                            '            <span style="font-size: 14px;color: #999;">'+data.itmsType3Num+'</span>\n' +
                            '            <span style="font-size: 14px;color: #999;">题</span>\n' +
                            '        </div>\n' +
                            '    </div>\n';

                        data.itmsType3.forEach(function (item, index) {
                            number+=1;
                            if(item.children.length>0){
                                let titleStr = '';
                                let childrenStr = '';
                                detailsStr +=
                                    '    <div class="list dis_row a_center" style="border-bottom: 1px solid #f7f7f7;height: 50px;margin-top: 20px;">\n' +
                                    '        <div class="list dis_row a_center" style="width: 100%;height: 100%;">\n' +
                                    '            <h3 style="margin-left: 10px;color: #666;line-height: 20px;">'+ number +'.&nbsp;&nbsp;\n';
                                item.children.forEach(function (item2, index2) {

                                    titleStr += '<span style="margin-left: 10px;color: #666;">' ;
                                    if(index2 < item.children.length-1){
                                        titleStr += item2.topic+'</span>' +
                                            '<span style="background-color: #e8f9ff;margin-left: 10px;color: #666;">(填空'+(index2+1)+')</span>';
                                    }else {
                                        titleStr += item2.topic+'</span>';
                                    }

                                    if(index2 < item.children.length-1) {
                                        childrenStr +=
                                            '    <div class="list dis_row a_center" style="border-bottom: 1px solid #f7f7f7;height: 50px;margin-top: 20px;">\n' +
                                            '        <div class="list dis_row a_center" style="width: 100%;height: 100%;">\n';
                                       // childrenStr +=
                                       //      '          <input style="margin-left: 40px;width: 80%;height: 50px;" type="text" onblur="changeValue(\'itmsType3\',\'\',' + index + ',\'itmsType3_' + index + '_'+ index2 +'\')" name="itmsType3_' + index+ '_'+ index2 +'\'" id="itmsType3_' + index + '_'+ index2 +'\'" value="' + item2.value + '"/>';
                                        childrenStr +=
                                            '          <input style="margin-left: 40px;width: 80%;height: 50px;" type="text" '+ disableStr +'  placeholder="请输入填空' + (index2+1) + '的答案"  onblur="changeValue(\'itmsType3\',this.value,' + index + ',' + index2 + ',\'itmsType3_' + index + '\')" name="itmsType3_' + index+ '_'+ index2 +'\'" id="itmsType3_' + index + '_'+ index2 +'\'" value="' + item2.value + '"/>';

                                        childrenStr +=
                                            '        </div>\n' +
                                            '    </div>\n';
                                    }
                                });
                                titleStr += ' &nbsp;<span style="color:green;">分值（'+item.score+'分）</span>';
                                if(showGetScore) {
                                    titleStr +='<span style="color:red;">得分（' + item.getScore + '分）</span>';
                                }
                                titleStr +='</h3>';
                                detailsStr += titleStr;
                                detailsStr +='</div>\n' +
                                    '    </div>\n';
                                detailsStr += childrenStr;

                            }
                        });
                    }
                    if(data.itmsType4Num>0){
                        detailsStr +=
                            '    <div class="list dis_row a_center" style="border-bottom: 1px solid #f7f7f7;height: 50px;margin-top: 20px;">\n' +
                            '        <div class="list dis_row a_center" style="background-color: #f7f7f7;width: 100%;height: 100%;">\n' +
                            '            <h2 style="margin-left: 10px;color: #000;">问答题</h2>\n' +
                            '            <span style="font-size: 14px;color: #999;margin-left: 10px;">共</span>\n' +
                            '            <span style="font-size: 14px;color: #999;">'+data.itmsType4Num+'</span>\n' +
                            '            <span style="font-size: 14px;color: #999;">题</span>\n' +
                            '        </div>\n' +
                            '    </div>\n';
                        data.itmsType4.forEach(function (item, index) {
                            number+=1;
                            detailsStr +=
                                '    <div class="list dis_row a_center" style="border-bottom: 1px solid #f7f7f7;height: 50px;margin-top: 20px;">\n' +
                                '        <div class="list dis_row a_center" style="width: 100%;height: 100%;">\n' +
                                '            <h3 style="margin-left: 10px;color: #666;line-height: 20px;">'+ number +'.&nbsp;&nbsp;'+item.topic_content+' &nbsp;<span style="color:green;">分值（'+item.score+'分）</span>';
                            if(showGetScore) {
                                detailsStr +='<span style="color:red;">得分（' + item.getScore + '分）</span>';
                            }
                            detailsStr +='</h3>\n' +
                                '        </div>\n' +
                                '    </div>\n';

                            detailsStr +=
                                '    <div class="list dis_row a_center" style="border: 1px solid #edfdff;height: 100px;margin-top: 20px;">\n' +
                                '        <div class="list dis_row a_center" style="width: 100%;height: 100%;">\n';
                            detailsStr +=
                                    '            <textarea style="margin-left: 40px;height: 100px;width: 80%;border: 1px solid #999;"  '+ disableStr +'  placeholder="请输入答案" onblur="changeValue(\'itmsType4\',this.value,'+index+ ',\'\',\'itmsType4_'+index+'\')" name="itmsType4_'+index+'">'+item.answer+'</textarea>';

                            detailsStr +=
                                '        </div>\n' +
                                '    </div>\n';
                        });
                    }
                    detailsStr += '</div>';

                    $("#courseAndTaskList").hide();
                    $("#courseAndTaskDetails").html(detailsStr);
                    $("#courseAndTaskDetails").show();
                }
            }
        )
    }

    function returnTaskList() {
        $("#courseAndTaskDetails").html("");
        $("#courseAndTaskDetails").hide();
        $("#courseAndTaskList").show();
    }

    function changeValue(type,value,index,index2,name) {
        if(type == 'itmsType0'){
            items.itmsType0[index].answer = value;
        }else if(type == 'itmsType1'){
            var obj = document.getElementsByName(name);
            let newValue='';
            for (var i = 0; i < obj.length; i++) {
                if (obj[i].checked) {
                   newValue += obj[i].value+";;";
                }
            }
            items.itmsType1[index].answer = newValue;
        }else if(type == 'itmsType2') {
            items.itmsType2[index].answer = value;
        }else if(type == 'itmsType3') {
            items.itmsType3[index].children[index2].value = value;
            let size = items.itmsType3[index].childrenSize;
            let newValue='';
            if(size>0){
                for (var i = 0; i < size; i++) {
                    if(i<size-1){
                        let cValue = items.itmsType3[index].children[i].value;
                        newValue += cValue+";;";
                    }
                }
            }
            items.itmsType3[index].answer = newValue;
        }else if(type == 'itmsType4') {
            items.itmsType4[index].answer = value;
        }
        //console.log(JSON.stringify(items));
    }

    function stubmitTasksAswer(type) {
        var index = layer.load(1, {
            shade: [0.1,'#fff'] ,//0.1透明度的白色背景
            content:'请稍候，正在提交作业...',
            success: function (layerContentStyle) {
                layerContentStyle.find('.layui-layer-content').css({
                    'padding-top': '35px',
                    'text-align': 'left',
                    'width': '300px'
                });
            }
        });
        console.log("type:"+type);
        let submitData = {
            "submitType": type,
            "papersDeploymentId": items.id,
            "submitId": items.submitId,
            "itmsAnswer": '',
        }
        let array = [];
        if(items.itmsType0Num>0){
            for(let a = 0;a < items.itmsType0.length; a++){
                let obj ={
                    "id": items.itmsType0[a].id,
                    "answer": items.itmsType0[a].answer
                }
                array.push(obj);
            }
        }
        if(items.itmsType1Num>0){
            for(let a = 0;a < items.itmsType1.length; a++){
                let obj ={
                    "id": items.itmsType1[a].id,
                    "answer": items.itmsType1[a].answer
                }
                array.push(obj);
            }
        }
        if(items.itmsType2Num>0){
            for(let a = 0;a < items.itmsType2.length; a++){
                let obj ={
                    "id": items.itmsType2[a].id,
                    "answer": items.itmsType2[a].answer
                }
                array.push(obj);
            }
        }
        if(items.itmsType3Num>0){
            for(let a = 0;a < items.itmsType3.length; a++){
                let obj ={
                    "id": items.itmsType3[a].id,
                    "answer": items.itmsType3[a].answer
                }
                array.push(obj);
            }
        }
        if(items.itmsType4Num>0){
            for(let a = 0;a < items.itmsType4.length; a++){
                let obj ={
                    "id": items.itmsType4[a].id,
                    "answer": items.itmsType4[a].answer
                }
                array.push(obj);
            }
        }
        submitData.itmsAnswer = JSON.stringify(array);
        console.log("submitData:"+JSON.stringify(submitData));

        ajaxToken("/jzApi/courses/submitTasksAnswer", 'POST',
            submitData,
            function (res) {
                layer.close(index);
                console.log("res:"+res);
                console.log("res:"+JSON.stringify(res));
                if (res == 1) {
                    this.returnTaskList();
                    layer.msg("作业已提交！");
                }else {
                    layer.msg(res);
                }
            }
        )
    }

    function ShrinkTask(id) {
        let display =$("#icon_down_" + id).css('display');
        //console.log("display:"+display);
        if(display == 'none') {
            $("#icon_down_" + id).show();
            $("#icon_right_" + id).hide();
        }else {
            $("#icon_down_" + id).hide();
            $("#icon_right_" + id).show();
        }
    }

    function toDeleteComment(id){
        if(id=='' || id==undefined || id=='undefined'){
            flag = false;
            layer.alert("参数错误！");
        }
        if(flag){
            ajaxToken("/jzApi/courses/deleteComment", 'POST',
                {
                    id: id
                }, function (res) {
                    /*console.log("res:"+res);
                    console.log("res:"+JSON.stringify(res));*/
                    if (res== 1) {
                        layer.msg("评论已删除！");
                        if(rootId!=-1 && rootId!='' && rootId!=undefined && rootId!='undefined'){
                            getSubCommentList(rootId);
                        }else {
                            getCommentList();
                        }
                    }else {
                        layer.alert(res);
                    }
                }
            )
        }


    }
    function toSendMessage(pid){
        let coursesId = $("#coursesId").val();
        let message = $("#message").val();
        let rootId = $("#rootId").val();
        let isAnonymous = '';

        if(document.getElementById("isAnonymous").checked){
            isAnonymous = 1;
        }else {
            isAnonymous = 0;
        }
        /*console.log("message:"+message);
        console.log("isAnonymous:"+isAnonymous);
        console.log("pid:"+pid);*/
        let flag = true;
        if(message=='' || message==undefined || message=='undefined'){
            flag = false;
            layer.alert("请输入评论内容！");
        }
        if(flag){
            ajaxToken("/jzApi/courses/addComment", 'POST',
                {
                    message: message,
                    isAnonymous: isAnonymous,
                    pid: pid,
                    rootId: rootId,
                    coursesId: coursesId
                }, function (res) {
                    console.log("res:"+res);
                    console.log("res:"+JSON.stringify(res));
                    if (res== 1) {
                        //清空
                        document.getElementById("isAnonymous").checked=false;
                        $("#message").val("");
                        layer.msg("评论已提交！");
                        if(rootId!=-1 && rootId!='' && rootId!=undefined && rootId!='undefined'){
                            getSubCommentList(rootId);
                        }else {
                            getCommentList();
                        }
                    }else {
                        layer.alert(res);
                    }
                }
            )
        }


    }
    function getCommentList(){
        $.ajax({
            url: "/jzApi/courses/selCommentList",
            type: 'GET',
            data: {
                id: $("#courseId").val(),
                rootId: '',
                current:1,
                number:10
            },
            success: function (res) {
                //console.log("res:"+JSON.stringify(res));
                if (res.data == 0) {

                    $("#commentListDiv").html('         <div class="dis_row a_center j_center discuss_buttons_textarea" style="margin-top: 5px;width: 200px;height: 80px;background-color: #fff; border:0;border-bottom: 3px solid #22ac38;font-size: 18px;">\n' +
                        '                                    当前评论数：0\n' +
                        '                                </div>\n' +
                        '                                <div style="margin-top: 50px;"></div>' +
                        '                                <div id="commentList" class="dis_column a_center j_center discuss_list" style="height: 100px;">\n' +
                        '                                    暂无记录~\n' +
                        '                                </div>');
                } else {
                    let list = res.data;
                    CommentList = list;
                    let commentList = '<div class="dis_row a_center j_center discuss_buttons_textarea" style="margin-top: 5px;width: 200px;height: 80px;background-color: #fff; border:0;border-bottom: 3px solid #22ac38;font-size: 18px;">\n' +
                        '                                    当前评论数：'+list.length+'\n' +
                        '                                </div>\n' +
                        '                                <div style="margin-top: 50px;"></div>';
                    list.forEach(function (item, index) {

                        commentList += '<div class="discuss_list dis_column a_center j_center">\n' +
                            '                                        <div class="dis_row a_center discuss_list" style="height: 80px;width: 82%;">\n' ;
                        let margin_str="";
                        if(item.headPortrait==''){
                            margin_str="";
                            commentList += '';
                            //commentList += '                                  <div style="height: 50px;width: 50px;border-radius: 50px;border: 1px solid #999;"> </div>\n';
                        }else {
                            margin_str="margin-left: 5%;";
                            commentList +='                             <div class="dis_row a_center discuss_list" style="width: 80px;">\n'+
                                '                                           <img src="'+ item.headPortrait +'" style="height: 50px;width: 50px;border-radius: 50px;">\n'+
                                '                                        </div>\n' ;
                        }
                        if(item.isAnonymous==1){
                            commentList +=
                                '                                            <div class="dis_row a_center discuss_list" style="height: 80px;width: auto;margin-left: 7px;color: #000;">\n' +
                                '匿名用户\n' +
                                '                                            </div>\n';
                        }else {
                            commentList +=
                                '                                            <div class="dis_row a_center discuss_list" style="height: 80px;width: auto;margin-left: 7px;color: #000;">\n' +
                                item.userName+'\n' +
                                '                                            </div>\n';
                            if(item.isTeacher==1){
                                commentList +='                              <div class="dis_row a_center j_center discuss_list" style="height: auto;width: auto; font-size: 14px; margin-left: 7px;color: #fe490a;border: 1px solid #fe490a;border-radius: 4px;padding: 3px 5px;">\n' +
                                    '                                                讲师\n' +
                                    '                                            </div>\n';
                            }else if(item.isStudent==1){
                                commentList +='                              <div class="dis_row a_center j_center discuss_list" style="height: auto;width: auto; font-size: 14px;margin-left: 7px;color: #fe9157;border: 1px solid #fe9157;border-radius: 4px;padding: 3px 5px;">\n' +
                                    '                                            学生\n' +
                                    '                                        </div>';
                            }else {
                                commentList +='                              <div class="dis_row a_center j_center discuss_list" style="height: auto;width: auto; font-size: 14px;margin-left: 7px;color: #666;border: 1px solid #666;border-radius: 4px;padding: 3px 5px;">\n' +
                                    '                                            其他用户\n' +
                                    '                                        </div>';
                            }
                            if(item.classesName!=''){
                                commentList +='                              <div class="dis_row a_center j_center discuss_list" style="height: auto;width: auto; font-size: 14px;margin-left: 7px;color: #999;background-color: #e8f9ff;border-radius: 4px;padding: 5px 5px;">\n' +
                                    item.classesName+' \n' +
                                    '                                        </div>';
                            }
                            if(item.orgName!=''){
                                commentList +='                              <div class="dis_row a_center j_center discuss_list" style="height: auto;width: auto; font-size: 14px;margin-left: 7px;color: #999;background-color: #e9fff4;border-radius: 4px;padding: 5px 5px;">\n' +
                                    item.orgName+' \n' +
                                    '                                        </div>';
                            }
                        }
                        if(rootItem.isDelete == 1){
                            commentList +='                              </div>\n' +
                                '                                        <div class="dis_row a_center j_center discuss_list" style="height: auto;width: 90%;">\n' +
                                '                                            <div class="dis_row a_center discuss_list" style="width: 90%;'+margin_str+'color: #666;">\n' +
                                '该评论已删除！\n' +
                                '                                            </div>\n' +
                                '                                        </div>\n';
                        }else {
                            commentList +='                              </div>\n' +
                                '                                        <div class="dis_row a_center j_center discuss_list" style="height: auto;width: 90%;">\n' +
                                '                                            <div class="dis_row a_center discuss_list" style="width: 90%;'+margin_str+'color: #666;">\n' +
                                item.content+'\n' +
                                '                                            </div>\n' +
                                '                                        </div>\n';
                        }
                        if(item.children.length>0){
                            commentList +='                         <div class="dis_row a_center j_center discuss_list" style="height: 1px;background-color: #E2E2E2;margin-top: 20px; margin-bottom: 20px;"></div>\n'+
                                '                                   <div  onclick="reply('+index+',\''+item.id+'\')" class="dis_column j_center discuss_list" style="width: 70%;height: 100px;margin-left: 15%;background-color: #f5f5f5;">\n' +
                                '                                            <div class="dis_row a_center j_center discuss_list" style="height: 80px;background-color: #f5f5f5;">\n' +
                                '                                                <div class="dis_row a_center discuss_list" style="height: 80px;width: auto;margin-left: 10px;color: #000;background-color: #f5f5f5;">\n' +
                                item.children[0].userName+':\n' +
                                '                                                </div>\n' ;
                            if(item.children[0].isDelete==1){
                                commentList +='                                     <div class="dis_row a_center discuss_list" style="width: 90%;height: 80px;margin-left: 7px;overflow: hidden;background-color: #f5f5f5;color: #666;">\n' +
                                    '该评论已删除！\n' +
                                    '                                                </div>\n' +
                                    '                                            </div>\n' +
                                    '                                        </div>\n' ;
                            }else {
                                commentList +='                                   <div class="dis_row a_center discuss_list" style="width: 90%;height: 80px;margin-left: 7px;overflow: hidden;background-color: #f5f5f5;color: #666;">\n' +
                                    item.children[0].content+'\n' +
                                    '                                                </div>\n' +
                                    '                                            </div>\n' +
                                    '                                        </div>\n' ;
                            }
                        }
                        commentList +='\n' +
                            '                                        <div class="dis_row a_center j_center discuss_list" style="height: 80px;width: 82%;">\n' +
                            '                                            <div class="dis_row a_center discuss_list" style="height: 80px;width: 50%;font-size: 12px;">\n' +
                            item.addTime+'\n' +
                            '                                            </div>\n' +
                            '                                            <div class="dis_row a_center discuss_list" style="height: 80px;width: 50%;justify-content: flex-end;font-size: 12px;color: #666;">\n';
                        if(item.isCurrentUser==1 && item.children.length==0){
                            commentList +='                                  <span onclick="toDeleteComment(\''+item.id+'\')" >删除</span>\n';
                        }
                        commentList +='                                      <span onclick="reply('+index+',\''+item.id+'\')" style="margin-left: 10px;">回复('+item.childrenSize+')</span>\n' +
                            '                                                <span style="margin-left: 10px;font-size: 18px;">...</span>\n' +
                            '                                            </div>\n' +
                            '                                        </div>\n' +
                            '                                        <div class="dis_row a_center j_center discuss_list" style="height: 10px;background-color: #f7f7f7; "></div>\n' +
                            '                                    </div>';
                    });
                    $("#commentListDiv").html(commentList);
                }
                page(1,res.data.pages);
            }
        });
    }
    function reply(index,rootId){
        rootItem = CommentList[index];
        console.log("rootItem:"+JSON.stringify(rootItem));
        $("#commentListDiv").hide();

        console.log("rootId:"+rootId);
        $("#rootId").val(rootId);
        let pageRootId = $("#rootId").val();
        console.log("pageRootId:"+pageRootId);
        getSubCommentList(rootId);
    }
    function replySub(pid){
        //console.log("rootId:"+rootId);
        $("#pid").val(pid);
        let pagePid = $("#pid").val();
        //console.log("pagePid:"+pagePid);

        //滚动到发布评论框 #sendMessageDiv
        var position = $("#sendMessageDiv").offset();
        position.top = position.top-250;
        $("html,body").animate({scrollTop:position.top}, 100);
        $("#message").focus();
        layer.msg("输入内容，发布即可回复");
    }
    function showRoot(){
        $("#commentListDiv").show();
        $("#subCommentListDiv").html("");
        getCommentList();
    }

    function getSubCommentList(rootId) {
        $("#subCommentListDiv").html("");
        $.ajax({
            url: "/jzApi/courses/selCommentList",
            type: 'GET',
            data: {
                id: $("#courseId").val(),
                rootId: rootId
            },
            success: function (res) {
                // console.log("res:"+JSON.stringify(res));
                let commentList = '<div class="layui-container">\n' +
                    '        <p onclick="showRoot()" style="line-height: 40px">< 返回</p>\n' +
                    '    </div>';
                //根评论
                commentList += '                 <div class="discuss_list dis_column a_center j_center">\n' +
                    '                                        <div class="dis_row a_center discuss_list" style="height: 80px;width: 82%;">\n';
                let margin_str = "";
                if (rootItem.headPortrait == '') {
                    margin_str = "";
                    commentList += '';
                } else {
                    margin_str = "margin-left: 5%;";
                    commentList += '                             <div class="dis_row a_center discuss_list" style="width: 80px;">\n' +
                        '                                           <img src="' + rootItem.headPortrait + '" style="height: 50px;width: 50px;border-radius: 50px;">\n' +
                        '                                        </div>\n';
                }
                if (rootItem.isAnonymous == 1) {
                    commentList +=
                        '                                            <div class="dis_row a_center discuss_list" style="height: 80px;width: auto;margin-left: 7px;color: #000;">\n' +
                        '匿名用户\n' +
                        '                                            </div>\n';
                } else {
                    commentList +=
                        '                                            <div class="dis_row a_center discuss_list" style="height: 80px;width: auto;margin-left: 7px;color: #000;">\n' +
                        rootItem.userName + '\n' +
                        '                                            </div>\n';
                    if (rootItem.isTeacher == 1) {
                        commentList += '                              <div class="dis_row a_center j_center discuss_list" style="height: auto;width: auto; font-size: 14px; margin-left: 7px;color: #fe490a;border: 1px solid #fe490a;border-radius: 4px;padding: 3px 5px;">\n' +
                            '                                                讲师\n' +
                            '                                            </div>\n';
                    } else if (rootItem.isStudent == 1) {
                        commentList += '                              <div class="dis_row a_center j_center discuss_list" style="height: auto;width: auto; font-size: 14px;margin-left: 7px;color: #fe9157;border: 1px solid #fe9157;border-radius: 4px;padding: 3px 5px;">\n' +
                            '                                            学生\n' +
                            '                                        </div>';
                    } else {
                        commentList += '                              <div class="dis_row a_center j_center discuss_list" style="height: auto;width: auto; font-size: 14px;margin-left: 7px;color: #666;border: 1px solid #666;border-radius: 4px;padding: 3px 5px;">\n' +
                            '                                            其他用户\n' +
                            '                                        </div>';
                    }
                    if (rootItem.classesName != '') {
                        commentList += '                              <div class="dis_row a_center j_center discuss_list" style="height: auto;width: auto; font-size: 14px;margin-left: 7px;color: #999;background-color: #e8f9ff;border-radius: 4px;padding: 5px 5px;">\n' +
                            rootItem.classesName + ' \n' +
                            '                                        </div>';
                    }
                    if (rootItem.orgName != '') {
                        commentList += '                              <div class="dis_row a_center j_center discuss_list" style="height: auto;width: auto; font-size: 14px;margin-left: 7px;color: #999;background-color: #e9fff4;border-radius: 4px;padding: 5px 5px;">\n' +
                            rootItem.orgName + ' \n' +
                            '                                        </div>';
                    }
                }
                if(rootItem.isDelete == 1){
                    commentList += '                              </div>\n' +
                        '                                        <div class="dis_row a_center j_center discuss_list" style="height: auto;width: 90%;">\n' +
                        '                                            <div class="dis_row a_center discuss_list" style="width: 90%;' + margin_str + 'color: #666;">\n' +
                        '该评论已删除！\n' +
                        '                                            </div>\n' +
                        '                                        </div>\n';
                }else {
                    commentList += '                              </div>\n' +
                        '                                        <div class="dis_row a_center j_center discuss_list" style="height: auto;width: 90%;">\n' +
                        '                                            <div class="dis_row a_center discuss_list" style="width: 90%;' + margin_str + 'color: #666;">\n' +
                        rootItem.content + '\n' +
                        '                                            </div>\n' +
                        '                                        </div>\n';
                }
                commentList += '\n' +
                    '                                        <div class="dis_row a_center j_center discuss_list" style="height: 80px;width: 82%;">\n' +
                    '                                            <div class="dis_row a_center discuss_list" style="height: 80px;width: 50%;font-size: 12px;">\n' +
                    rootItem.addTime + '\n' +
                    '                                            </div>\n' +
                    '                                            <div class="dis_row a_center discuss_list" style="height: 80px;width: 50%;justify-content: flex-end;font-size: 12px;color: #666;">\n';

                commentList +=
                    '                                            </div>\n' +
                    '                                        </div>\n' +
                    '                                        <div class="dis_row a_center j_center discuss_list" style="height: 10px;background-color: #f7f7f7; "></div>\n' +
                    '                                    </div>';



                if (res.data == 0) {

                    commentList +='                      <div class="dis_row a_center j_center discuss_buttons_textarea" style="margin-top: 5px;width: 200px;height: 80px;background-color: #fff; border:0;border-bottom: 3px solid #22ac38;font-size: 18px;">\n' +
                        '                                    回复数：0\n' +
                        '                                </div>\n' +
                        '                                <div style="margin-top: 50px;"></div>' +
                        '                                <div id="commentList" class="dis_column a_center j_center discuss_list" style="height: 100px;">\n' +
                        '                                    暂无记录~\n' +
                        '                                </div>';
                    $("#subCommentListDiv").html(commentList);
                } else {
                    let list = res.data;

                    //子评论
                    commentList += '                     <div class="dis_row a_center j_center discuss_buttons_textarea" style="margin-top: 5px;width: 200px;height: 80px;background-color: #fff; border:0;border-bottom: 3px solid #22ac38;font-size: 18px;">\n' +
                        '                                    回复数：'+list.length+'\n' +
                        '                                </div>\n' +
                        '                                <div style="margin-top: 50px;"></div>';

                    list.forEach(function (item, index) {

                        commentList += '                 <div class="discuss_list dis_column a_center j_center">\n' +
                            '                                        <div  onclick="replySub(\''+item.id+'\')" class="dis_row a_center discuss_list" style="height: 80px;width: 82%;">\n';
                        let margin_str = "";
                        if (item.headPortrait == '') {
                            margin_str = "";
                            commentList += '';
                        } else {
                            margin_str = "margin-left: 5%;";
                            commentList += '                             <div class="dis_row a_center discuss_list" style="width: 80px;">\n' +
                                '                                           <img src="' + item.headPortrait + '" style="height: 50px;width: 50px;border-radius: 50px;">\n' +
                                '                                        </div>\n';
                        }
                        if (item.isAnonymous == 1) {
                            commentList +=
                                '                                            <div class="dis_row a_center discuss_list" style="height: 80px;width: auto;margin-left: 7px;color: #000;">\n' +
                                '匿名用户\n' +
                                '                                            </div>\n';
                        } else {
                            commentList +=
                                '                                            <div class="dis_row a_center discuss_list" style="height: 80px;width: auto;margin-left: 7px;color: #000;">\n' +
                                item.userName + '\n' +
                                '                                            </div>\n';
                            if (item.isTeacher == 1) {
                                commentList += '                              <div class="dis_row a_center j_center discuss_list" style="height: auto;width: auto; font-size: 14px; margin-left: 7px;color: #fe490a;border: 1px solid #fe490a;border-radius: 4px;padding: 3px 5px;">\n' +
                                    '                                                讲师\n' +
                                    '                                            </div>\n';
                            } else if (item.isStudent == 1) {
                                commentList += '                              <div class="dis_row a_center j_center discuss_list" style="height: auto;width: auto; font-size: 14px;margin-left: 7px;color: #fe9157;border: 1px solid #fe9157;border-radius: 4px;padding: 3px 5px;">\n' +
                                    '                                            学生\n' +
                                    '                                        </div>';
                            } else {
                                commentList += '                              <div class="dis_row a_center j_center discuss_list" style="height: auto;width: auto; font-size: 14px;margin-left: 7px;color: #666;border: 1px solid #666;border-radius: 4px;padding: 3px 5px;">\n' +
                                    '                                            其他用户\n' +
                                    '                                        </div>';
                            }
                            if (item.classesName != '') {
                                commentList += '                              <div class="dis_row a_center j_center discuss_list" style="height: auto;width: auto; font-size: 14px;margin-left: 7px;color: #999;background-color: #e8f9ff;border-radius: 4px;padding: 5px 5px;">\n' +
                                    item.classesName + ' \n' +
                                    '                                        </div>';
                            }
                            if (item.orgName != '') {
                                commentList += '                              <div class="dis_row a_center j_center discuss_list" style="height: auto;width: auto; font-size: 14px;margin-left: 7px;color: #999;background-color: #e9fff4;border-radius: 4px;padding: 5px 5px;">\n' +
                                    item.orgName + ' \n' +
                                    '                                        </div>';
                            }
                        }
                        if(item.fromUserName!=''){
                            commentList +=
                                '                                            <div class="dis_row a_center discuss_list" style="height: 80px;width: auto;margin-left: 7px;color: #000;">\n' +
                                '<span style="margin-left: 10px">回复</span><span style="margin-left: 10px">'+ item.fromUserName + '</span>\n' +
                                '                                            </div>\n';
                        }
                        if(item.isDelete == 1){
                            commentList += '                              </div>\n' +
                                '                                        <div  onclick="replySub(\''+item.id+'\')"  class="dis_row a_center j_center discuss_list" style="height: auto;width: 90%;">\n' +
                                '                                            <div class="dis_row a_center discuss_list" style="width: 90%;' + margin_str + 'color: #666;">\n' +
                                '该评论已删除！\n' +
                                '                                            </div>\n' +
                                '                                        </div>\n';
                        }else {
                            commentList += '                              </div>\n' +
                                '                                        <div  onclick="replySub(\''+item.id+'\')"  class="dis_row a_center j_center discuss_list" style="height: auto;width: 90%;">\n' +
                                '                                            <div class="dis_row a_center discuss_list" style="width: 90%;' + margin_str + 'color: #666;">\n' +
                                item.content + '\n' +
                                '                                            </div>\n' +
                                '                                        </div>\n';
                        }

                        commentList += '\n' +
                            '                                        <div class="dis_row a_center j_center discuss_list" style="height: 80px;width: 82%;">\n' +
                            '                                            <div class="dis_row a_center discuss_list" style="height: 80px;width: 50%;font-size: 12px;">\n' +
                            item.addTime + '\n' +
                            '                                            </div>\n' +
                            '                                            <div class="dis_row a_center discuss_list" style="height: 80px;width: 50%;justify-content: flex-end;font-size: 12px;color: #666;">\n';
                        if (item.isCurrentUser == 1 && item.isDelete == 0) {
                            commentList += '                                  <span onclick="toDeleteComment(\''+item.id+'\')">删除</span>\n';
                        }
                        commentList += '                                      <span onclick="replySub(\''+item.id+'\')" style="margin-left: 10px;">回复</span>\n' +
                            '                                                <span style="margin-left: 10px;font-size: 18px;"></span>\n' +
                            '                                            </div>\n' +
                            '                                        </div>\n' +
                            '                                        <div class="dis_row a_center j_center discuss_list" style="height: 10px;background-color: #f7f7f7; "></div>\n' +
                            '                                    </div>';
                    });

                    $("#subCommentListDiv").html(commentList);
                }
            }
        });
    }

    function submit() {
        var is_mobi = navigator.userAgent.toLowerCase().match(/(ipod|iphone|android|coolpad|mmp|smartphone|midp|wap|xoom|symbian|j2me|blackberry|wince)/i) != null;
        ajaxToken("/jzApi/user/selUserDetail", "GET", {}, function (r) {
            // console.log("结果：" , r)
            // console.log(r.name)
            if (r.state == 1){
                // if (r.headPortrait != "" && r.headPortrait != null && r.name != "" && r.name != null && r.sex != "" &&
                //     r.sex != null && r.idNumber != "" && r.idNumber != null && r.mobile != "" && r.mobile != null &&
                //     r.dateOfBirth != "" && r.dateOfBirth != null && r.nation != "" &&
                //     r.nation != null && r.education != "" && r.education != null && r.major != "" && r.major != null &&
                //     r.politicalAffiliation != "" && r.politicalAffiliation != null && (r.officialCapacity != "" &&
                //         r.officialCapacity != null) && r.province != "" && r.province != null && r.province != "" && r.province != null &&
                //     r.city != "" && r.city != null && r.liveAddress != "" && r.liveAddress != null && r.experience != "" &&
                //     r.experience != null){

                ajaxToken("/jzApi/courses/selCourseOrder", "POST", {
                    id: $("#courseId").val()
                }, function (res) {
                    location.href = '/couInfo/courseSurePay?orderId=' + res.orderId + '&courseId=' + $("#courseId").val() + '&type=0';
                });
                // }else {
                //     layer.alert("完善个人信息才能报名该课程");
                // }
            }
            else if(r.state == 0){
                layer.alert("个人信息审核通过才能报名该课程");
            }else if(r.state == 3){
                if(is_mobi){
                    layer.confirm('完善个人信息才能报名该课程？', {
                        btn: ['确定','取消']
                    }, function(){

                        location.href = '/cultivate/my'
                    });
                }else{
                    layer.alert("完善个人信息才能报名该课程");
                }

            }

        })


    }


    //获取配套资源列表
    function selExtendList() {
        $.ajax({
            url: "/jzApi/courses/selExtendList",
            type: 'GET',
            data: {id: $("#courseId").val()},
            success: function (res) {
                if (res.data == 0) {
                    $("#extendList").html('<div class="noData">暂无数据</div>');
                } else {
                    var list = res.data;
                    var categoryList = '';
                    list.forEach(function (item, index) {
                        var resourceList = item.resources;
                        
                        var resourceListStr='<div class="list"><span class="chapterTitle">'+item.name+'</span>';
                        var a = '';
                        if (item.isFree==0) {
                            a='<text style="color:#005c34">(可试看)</text>'
                        }
                        if(resourceList.length>0){
                            resourceList.forEach(function (item2,index2){
                                resourceListStr+='<div class="chapter"><a href="/cultivate/study/studyChapter?id=' + item2.id +'&chapterId='+item2.chapterId+ '&courseId=' + $("#courseId").val() + '">' +
                            '<div class="cpt"></div>' +
                            '<span class="cpt">' + item2.name +'</span class="cpt">' +
                            '<span class="min">' + a+ item2.videoDuration + '</span>' +
                            '<div style="clear: both"></div></a></div>';
                            });
                        }else{
                            resourceListStr+='<div class="chapter"><div class="noData">暂无数据</div></div>';
                        }
                        categoryList += resourceListStr+'</div>';
                        
                    });
                    $("#extendList").html(categoryList);
                }
            }
        });
    }
    // <!-- 课程章节 -->   <!-- 章节练习 -->
    function selChapterList() {
        $.ajax({
            url: "/jzApi/courses/selChapterList",
            type: 'GET',
            data: {id: $("#courseId").val()},
            success: function (res) {
                if (res.data == 0) {
                    $("#chapterList").html('<div class="noData">暂无数据</div>');
                } else {
                    var list = res.data;
                    var categoryList = '';//<!-- 课程章节 -->
                    var chapterText='';   //<!-- 章节练习 -->
                    var a='';
                    var b='';
                    list.forEach(function (item, index) {
                        if(item.isChaItem=='true'){
                            a='/cultivate/study/studyPractice?id='+item.id+'&courseId='+$("#courseId").val()+'&isTestScores='+$("#isTestScores").val();
                            b='进入练习'
                        }else{
                            a='javascript:void(0)';
                            b='暂无练习题'
                        }
                        var resourceList = item.resources;
                        var resourceListStr='<div class="list"><span class="chapterTitle">'+item.name+'</span>';
                        resourceList.forEach(function (item2,index2){
                            resourceListStr+='<div class="chapter"><a href="/cultivate/study/studyChapter?id=' + item2.id +'&chapterId='+item2.chapterId+ '&courseId=' + $("#courseId").val() + '">' +
                            '<div class="cpt"></div>' +
                            '<span class="cpt">' + item2.name +'</span class="cpt">' +
                            '<span class="min">' + item2.videoDuration + '</span>' +
                            '<div style="clear: both"></div></a></div>';
                        });
                        categoryList += resourceListStr+'</div>';

                        chapterText += '<div class="chapter"><a  href="'+a+'">' +
                            '<span class="cpt">' + item.name + '</span class="cpt">' +
                            '<span class="min" style="color:#005C34">'+b+'</span>' +
                            '<div style="clear: both"></div></a></div>';

                    });
                    $("#chapterList").html(categoryList);
                    $("#chapterText").html(chapterText);

                }
            }
        });
    }

    function ShrinkChapter(id) {
        let display =$("#chapter_" + id).css('display');
        //console.log("display:"+display);
        if(display == 'none') {
            let str="<i class=\"layui-icon layui-icon-down\" aria-hidden=\"true\"></i>";
            $('#icon_' + id).html(str);
        }else {
            let str="<i class=\"layui-icon layui-icon-right\" aria-hidden=\"true\"></i>";
            $('#icon_' + id).html(str);
        }
        $("#chapterList").find(".chapter_" + id).toggle();
    }


    function questions() {
        ajaxToken("/jzApi/courses/selQuestions", "GET", {
            courseId:$("#courseId").val(),
            current:1,
            number:10
        }, function (r) {
            var list = r.records;
            var Q = '';
            var a = 1;
            list.forEach(function (item, index) {
                Q += '<div style="margin: 15px">' +
                     '  <span class="no">' + (a + index) + '、</span>' +
                     '  <span>Q：' +
                     '      <span class="q_a">' + item.contents + '</span>' +
                     '      <span class="seeAns" onclick="seeAns(\''+item.id+'\')">查看详情</span>'+
                     '      <spsan class="delQue" onclick="delQue(\''+item.id+'\')">删除</spsan>'+
                     '  </span>' +
                     '</div>'
            })
            $("#courseAsk").html(Q);
            page(1,r.pages);
        })
    }

    function page(num, tolPages) {
        $("#page").paging({
            nowPage: Number(num), // 当前页码
            pageNum: Number(tolPages), // 总页码
            buttonNum: 10, //要展示的页码数量
            canJump: 1,// 是否能跳转。0=不显示（默认），1=显示
            showOne: 0,//只有一页时，是否显示。0=不显示,1=显示（默认）
            callback: function (num) { //回调函数

                ajaxToken("/jzApi/courses/selQuestions", "GET", {
                    courseId: $("#courseId").val(),
                    current: num,
                    number: 10
                }, function (r) {
                    var list = r.records;
                    var Q = '';
                    var a = 1;
                    list.forEach(function (item, index) {
                        Q += '<div style="margin: 15px">' +
                             '  <span class="no">' + (a + index) + '、</span>' +
                             '  <span>Q：' +
                             '      <span class="q_a">' + item.contents + '</span>' +
                             '      <span class="seeAns" onclick="seeAns(\''+item.id+'\')">查看详情</span>'+
                             '      <spsan class="delQue" onclick="delQue(\''+item.id+'\')">删除</spsan>'+
                             '  </span>' +
                             '</div>'
                    })
                    $("#courseAsk").html(Q);
                })
            }
        })
    }

    function send() {
        ajaxToken("/jzApi/courses/addQuestions", "POST", {
            courseId: $("#courseId").val(),
            questions: $('#questions').val()
        }, function (r) {
            questions();
            $('#questions').val("")
            $('#courseAndAsk').show();
        })
    }

    function seeAns(id) {
        ajaxToken("/jzApi/courses/selQuestionsDetails", "GET", {id:id}, function (r) {

            var answers = r.answers;
            if(answers){
                $('#ans').html(r.answers);
            }else{
                $('#ans').html("");
            }
            $('#ques').html(r.questions);


            layer.open({
                type: 1,
                title: '问题详情',
                closeBtn: 1,
                area: [ '550px', '300px' ],
                shadeClose: true,
                offset: 'c',
                content: $('#coursePanel')
            });

        })
    }

    function delQue(id) {
        layer.confirm('确定要删除该问题吗？', {
            btn: ['确定', '取消']
        }, function () {
            ajaxToken("/jzApi/courses/delQuestions", "GET", {id:id}, function (r) {
                layer.closeAll();
                questions();
                $('#courseAndAsk').show();
            })
        })
    }

</script>
</html>